package ac.you.api.chat.i;


import ac.you.api.chat.Tellraw;
import ac.you.api.chat.Text;
import ac.you.api.chat.e.At;
import ac.you.api.chat.e.Ho;
import com.google.gson.Gson;


public final class DomainText extends NormalText {
    abstract class Domain{
        private String value;
        Domain(String value){
            this.value = value;
        }

    }
    class Click extends Domain{
        private At action;
        Click(At action, String value) {
            super(value);
            this.action = action;
        }
    }
    class Hover extends Domain{
        private Ho action;
        Hover(Ho action, String value) {
            super(value);
            this.action = action;
        }
    }


    public Click clickEvent;
    public Hover hoverEvent;

    public DomainText(Tellraw tellraw,String content,Click clickEvent,Hover hoverEvent){
        super(tellraw,content);
        this.clickEvent = clickEvent;
        this.hoverEvent = hoverEvent;
    }
    public DomainText(Tellraw tellraw, String content){
        this(tellraw,content,null,null);
    }


    @Override
    public Tellraw tellraw(){
        return super.tellraw();
    }

    @Override
    public String toJson() {
        Gson gson = new Gson();
        return gson.toJson(this);
    }

    @Override
    public Text click(At action, String value) {
        clickEvent = new Click(action,value);
        return this;
    }

    @Override
    public Text hover(Ho action, String value) {
        hoverEvent = new Hover(action,value);
        return this;
    }

}
